package com.dyz.leetcode._04_bitOperation;

public class _405_toHex {
    public String toHex(int num) {
        if(num==0){return "0";}
        char[] chs = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
        String s = "";
        while(num!=0){
            int index = num&15;
            s = chs[index]+s;
            num = num >>> 4;
        }
        return s;
    }
}
